package com.woniuxy.common;

import java.util.Map;

import org.apache.commons.beanutils.BeanUtils;

public class CommonUtil {

	public static <T> T mapToBean(Map map, Class<T> clazz) {
		T bean = null;
		try {
			bean = clazz.newInstance();
			BeanUtils.populate(bean, map);
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		}
		return bean;
	}
}
